name: "Publish to PyPI"
on:
  release:
    types:
      - published
jobs:
  build-n-publish:
    name: Build and publish
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: actions/setup-python@v2
        with:
          python-version: '3.7'
          architecture: 'x64'
      - name: Run build script
        run: |
          echo "VERSION = \"${GITHUB_REF##refs/tags/v}\"" > OpenAttack/version.py
          pip install twine --user
          pip install wheel
          python setup.py sdist bdist_wheel
      - name: Publish distribution 📦 to PyPI
        uses: pypa/gh-action-pypi-publish@master
        with:
            user: __token__
            password: ${{ secrets.pypi_password }}